const db = require('./db');

function User(user) {
    this.username = user.username;
    this.password = user.password;
    this.email = user.email;
    // this.v_code = user.v_code;
}

// 查询用户
User.queryUser = async page => await db.query('select * from user');
User.findUserByUsername = async username => await db.query('select * from users where username = ?', [username]);
User.registerUser = async user => await db.query('insert into users (username, password, email) values (?,?,?)', Object.values(user));

module.exports = User;